package com.meaningful.thinking.schedule_demo;

import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter;

public class Main {

    public static void main(String[] args) throws InterruptedException {
        DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("HH:mm:ss SSS");
        ScheduleService scheduleService = new ScheduleService();
        scheduleService.schedule(
                () -> {
                    System.out.println(LocalDateTime.now().format(dateTimeFormatter) + "这是100ms");
                },
                100
        );

        Thread.sleep(1000);

        scheduleService.schedule(
                () -> {
                    System.out.println(LocalDateTime.now().format(dateTimeFormatter) + "这是200ms");
                },
                200
        );
    }

}
